/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.svh.test.Hibernate;

import com.svh.Entidad.Empleado;
import com.svh.Hibernate.HibernateConexion;
import com.svh.Hibernate.HibernatePaginator;
import com.svh.Utils.IConexion;
import java.util.List;
import org.hibernate.HibernateException;
import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Restrictions;
import org.junit.Assert;
import org.junit.Test;
/**
 *
 * @author COCO
 */
public class testempl  {
    
    
    
    @Test
    public void test(){
        
        IConexion conexion = new HibernateConexion();
        Throwable excepcion = null;
        DetachedCriteria criteria = null;
        
        try{
            conexion.beginConexion();
            criteria =DetachedCriteria.forClass(Empleado.class,"empleado").add(Restrictions.isNull("empleado.usuario"));
           HibernateConexion hconexion = (HibernateConexion) conexion;
           List<Empleado> empleados= criteria.getExecutableCriteria(hconexion.getSession()).list();
           for(Empleado empleado : empleados){
               System.out.println(""+empleados.toString());
           }
        }
       catch(Exception e)
        {
            excepcion =e;
    }
   Assert.assertNull(excepcion);
}



}
